import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getVideo } from '../api/videodes'

export const useScrollStore = defineStore('home', () => {
    let scrollIndex = ref<number>(0);
    let changeIndex = (currentIndex: number,top:number) => {
        scrollIndex.value = currentIndex;
    }
    let videoList:any = ref(null);
    let getVideoUrl:any = (videoid: number) => {
        getVideo(videoid).then((data) => {
            videoList.value = data.data
        })
        return videoList.value
      }
    return { scrollIndex, changeIndex,getVideoUrl,videoList }
})